home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / lib / uw_detach.c < prev    next >
C/C++ Source or Header  |  1991-01-25  |  677b  |  32 lines

  1. /*
  2.  *    uw library - uw_detach
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8. #include "uwlib.h"
  9.  
  10. uw_detach(uwin)
  11. UWIN uwin;
  12. {
  13.     /*
  14.      * Detach the control file descriptor for a window, while still
  15.      * retaining access to the data file descriptor.
  16.      */
  17.     if (uwin != (UWIN)0) {
  18.         if (uwin->uwi_ctlfd >= 0) {
  19.             uw_optdone(uwin->uwi_ctlfd);
  20.             (void)close(uwin->uwi_ctlfd);
  21.             uwin->uwi_ctlfd = -1;
  22.             return(0);
  23.         } else {
  24.             uwerrno = uwin->uwi_uwerr = UWE_NOCTL;
  25.             return(-1);
  26.         }
  27.     } else {
  28.         uwerrno = UWE_INVAL;
  29.         return(-1);
  30.     }
  31. }
  32.